@model ShoppingCartViewModel

@{
    var pageName = "Shopping Cart";
    ViewData["Title"] = pageName;
}

<h2>Your @pageName</h2>
<h4>Here are the yummy pizzas in your shopping cart.</h4>
<table class="table table-bordered table-striped">
    <thead>
        <tr>
            <th>Selected Amount</th>
            <th>Pizza</th>
            <th class="text-right">Price</th>
            <th class="text-right">Subtotal</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var line in Model.ShoppingCart.ShoppingCartItems)
        {
            <tr>
                <td class="text-center"><a class="btn btn-default" asp-action="RemoveFromShoppingCart" asp-route-pizzaId="@line.Pizza.Id"><b>-</b></a>          <b>@line.Amount</b>          <a class="btn btn-default" asp-action="AddToShoppingCart" asp-route-pizzaId="@line.Pizza.Id"><b>+</b></a></td>
                <td class="text-left">@line.Pizza.Name</td>
                <td class="text-right">@line.Pizza.Price.ToString("c")</td>
                <td class="text-right">
                    @((line.Amount * line.Pizza.Price).ToString("c"))
                </td>
            </tr>
        }
    </tbody>
    <tfoot>
        <tr>
            <td colspan="3" class="text-right">Total:</td>
            <td class="text-right">
                @Model.ShoppingCartTotal.ToString("c")
            </td>
        </tr>
    </tfoot>
</table>

<div align="right">
    @if (Model.ShoppingCartTotal > 0)
    {
        <a asp-controller="Orders" asp-action="Checkout" class="btn btn-primary">Check Out</a>
    }
</div>
<div align="left">
    <a asp-controller="ShoppingCart" asp-action="ClearCart" class="btn btn-danger">Clear Cart</a>
</div>

